home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NOVA - For the NeXT Workstation
/
NOVA - For the NeXT Workstation.iso
/
SourceCode
/
MiniExamples
/
AskMe
/
Clock.c
< prev
next >
Wrap
C/C++ Source or Header
|
1992-12-19
|
3KB
|
93 lines
/* Clock.c generated from Clock.psw
by unix pswrap V1.009 Wed Apr 19 17:50:24 PDT 1989
*/
#include <dpsclient/dpsfriends.h>
#include <string.h>
#line 1 "Clock.psw"
/*
* Clock.psw, Postscript code for drawing the digital clock.
* You may freely copy, distribute and reuse the code in this example.
* NeXT disclaims any warranty of any kind, expressed or implied, as to its
* fitness for any particular use.
*/
/* centerShow centers the width of a string at the specific x y location
* using specified gray
*/
#line 23 "Clock.c"
void PSWcenterShow(float x, float y, const char *str, float gray)
{
typedef struct {
unsigned char tokenType;
unsigned char sizeFlag;
unsigned short topLevelCount;
unsigned long nBytes;
DPSBinObjReal obj0;
DPSBinObjGeneric obj1;
DPSBinObjReal obj2;
DPSBinObjGeneric obj3;
DPSBinObjGeneric obj4;
DPSBinObjGeneric obj5;
DPSBinObjGeneric obj6;
DPSBinObjGeneric obj7;
DPSBinObjGeneric obj8;
DPSBinObjReal obj9;
DPSBinObjGeneric obj10;
DPSBinObjGeneric obj11;
DPSBinObjGeneric obj12;
DPSBinObjGeneric obj13;
} _dpsQ;
static const _dpsQ _dpsStat = {
DPS_DEF_TOKENTYPE, 0, 14, 120,
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: gray */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 150}, /* setgray */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: x */
{DPS_LITERAL|DPS_STRING, 0, 0, 112}, /* param str */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 166}, /* stringwidth */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 117}, /* pop */
{DPS_LITERAL|DPS_INT, 0, 0, 2},
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 54}, /* div */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 169}, /* sub */
{DPS_LITERAL|DPS_REAL, 0, 0, 0}, /* param: y */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 107}, /* moveto */
{DPS_LITERAL|DPS_STRING, 0, 0, 112}, /* param str */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 160}, /* show */
{DPS_EXEC|DPS_NAME, 0, DPSSYSNAME, 167}, /* stroke */
}; /* _dpsQ */
_dpsQ _dpsF; /* local copy */
register DPSContext _dpsCurCtxt = DPSPrivCurrentContext();
char pad[3];
register DPSBinObjRec *_dpsP = (DPSBinObjRec *)&_dpsF.obj0;
register int _dps_offset = 112;
_dpsF = _dpsStat; /* assign automatic variable */
_dpsP[2].val.realVal = x;
_dpsP[9].val.realVal = y;
_dpsP[3].length =
_dpsP[11].length = strlen(str);
_dpsP[0].val.realVal = gray;
_dpsP[11].val.stringVal = _dps_offset;
_dps_offset += (_dpsP[11].length + 3) & ~3;
_dpsP[3].val.stringVal = _dps_offset;
_dps_offset += (_dpsP[3].length + 3) & ~3;
_dpsF.nBytes = _dps_offset+8;
DPSBinObjSeqWrite(_dpsCurCtxt,(char *) &_dpsF,120);
DPSWriteStringChars(_dpsCurCtxt, (char *)str, _dpsP[11].length);
DPSWriteStringChars(_dpsCurCtxt, (char *)pad, ~(_dpsP[11].length + 3) & 3);
DPSWriteStringChars(_dpsCurCtxt, (char *)str, _dpsP[3].length);
DPSWriteStringChars(_dpsCurCtxt, (char *)pad, ~(_dpsP[3].length + 3) & 3);
if (0) *pad = 0; /* quiets compiler warnings */
}
#line 19 "Clock.psw"